- case @type
- when :xref
  - refid = (attr :refid) || @target
  %a(href="#{@target}")<=(@text || @document.references[:ids].fetch(refid, "[#{refid}]")).tr_s("\n", ' ')
- when :ref
  %a(id=@target)
- when :bibref
  %a(id=@target)>
  = surround '[', ']' do
    =@target
- else
  %a(href=@target){:class=>role, :target=>(attr :window)}=@text
